package com.wmh.baseservice.skd.mapper;

import com.wmh.baseservice.skd.pojo.SkdGroupBuyingActivities;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
* @author CH
* @description 针对表【skd_group_buying_activities(团购活动表)】的数据库操作Mapper
* @createDate 2024-01-03 09:21:39
* @Entity com.wmh.baseservice.skd.pojo.SkdGroupBuyingActivities
*/
public interface SkdGroupBuyingActivitiesMapper extends BaseMapper<SkdGroupBuyingActivities> {

    @Select("SELECT id,title,goods_snapshot,create_time FROM skd_group_buying_activities WHERE user_id = #{usId} AND deleted=1")
    List<SkdGroupBuyingActivities> getDeletedGroupBuyingActivities(Long usId);

    @Select("SELECT id FROM skd_group_buying_activities WHERE id = #{groupBuyingActivityId} AND deleted = 1")
    SkdGroupBuyingActivities getDeletedActivityById(Long groupBuyingActivityId);

    @Update("UPDATE skd_group_buying_activities SET deleted = 0 WHERE id = #{id}")
    boolean recoverActivity(Long id);

    @Select("SELECT * FROM skd_group_buying_activities WHERE id = #{groupBuyingActivityId}")
    SkdGroupBuyingActivities selectGroupBuyingActivity(Long groupBuyingActivityId);
}




